package com.itheima.smspringboot.controller;

import com.itheima.smspringboot.common.Result;
import com.itheima.smspringboot.service.AdminService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
public class WebController {

    @Resource
    private AdminService adminService;

    @GetMapping("/hello")
    public Result hello() {
        int i = 1 / 0;

        Map<String, Object> map = new HashMap<>();
        map.put("1","xiaomong");
        map.put("2","xiaomong");
        map.put("3","xiaomong");
        map.put("4","xiaomong");


        return  Result.success(map);

    }


    @GetMapping("/admin")
    public Result admin(String name) {

        String admin = adminService.adminLogin(name);
        return  Result.success(admin);

    }



}
